package com.fyakm.daodejing.simple.stockTest.domain;

import java.util.ArrayList;
import java.util.List;

/**
 * 股票历史
 *
 */
public class StockHistory {

    // 按照下标截取list
    public static List<StockHistory> subList(List<StockHistory> list, int start, int end) {
        List<StockHistory> subList = new ArrayList<>();
        for (int i = start; i < end; i++) {
            subList.add(list.get(i));
        }
        return subList;
    }

    // 按照日期截取list
    public static List<StockHistory> subListByDate(List<StockHistory> list, String startDate, String endDate) {
        List<StockHistory> subList = new ArrayList<>();
        for (StockHistory stockHistory : list) {
            if (stockHistory.getDate().compareTo(startDate) >= 0 && stockHistory.getDate().compareTo(endDate) <= 0) {
                subList.add(stockHistory);
            }
        }
        return subList;
    }


//               'code': '股票代码',
//               'date': '交易日期',
//               'open': '开盘价',
//               'high': '最高价',
//               'low': '最低价',
//               'close': '收盘价',
//               'preclose': '前收盘价',
//               'pctChg': '涨跌幅',
//               'volume': '成交量',
//               'amount': '成交额'


    // 股票代码
    private String code;

    // 交易日期
    private String date;

    // 开盘价
    private Double open;

    // 最高价
    private Double high;

    // 最低价
    private Double low;

    // 收盘价
    private Double close;

    // 前收盘价
    private Double preclose;

    // 涨跌幅
    private Double pctChg;

    // 成交量
    private Double volume;

    // 成交额
    private Double amount;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public Double getOpen() {
        return open;
    }

    public void setOpen(Double open) {
        this.open = open;
    }

    public Double getHigh() {
        return high;
    }

    public void setHigh(Double high) {
        this.high = high;
    }

    public Double getLow() {
        return low;
    }

    public void setLow(Double low) {
        this.low = low;
    }

    public Double getClose() {
        return close;
    }

    public void setClose(Double close) {
        this.close = close;
    }

    public Double getPreclose() {
        return preclose;
    }

    public void setPreclose(Double preclose) {
        this.preclose = preclose;
    }

    public Double getPctChg() {
        return pctChg;
    }

    public void setPctChg(Double pctChg) {
        this.pctChg = pctChg;
    }

    public Double getVolume() {
        return volume;
    }

    public void setVolume(Double volume) {
        this.volume = volume;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }
}
